package ldh.im.fxbase.util;

import javafx.stage.Stage;

import java.awt.*;

public class StageUtil {

    private static volatile Stage stage;

    public static void setStage(Stage stage) {
        StageUtil.stage = stage;
    }

    public static Stage getStage() {
        return stage;
    }

    public static void close() {
        if(stage != null) {
            stage.close();
            if(isSupportTray()) {
                System.exit(0);
            }
        }
    }

    public static boolean isMac() {
        return System.getProperty( "os.name", "" ).contains( "Mac" );
    }

    public static boolean isSupportTray() {
        return SystemTray.isSupported();
    }
}
